Search
 
SCRIPT & CODE EXAMPLE
 

C

array of strings in c

#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#define MAX_LENGTH 100
#define NUM_STRINGS 10

int main(){
    char *arr3[NUM_STRINGS] = { "first string",
                                "second string",
                                "third string",
                                "fourth string",
                                "fifth string" };
    char* str1 = "string literal";
    arr3[8] = str1;
    arr3[9] = "hello there";

    for (int i = 0; i < NUM_STRINGS; ++i) {
        printf("%s, ", arr3[i]);
    }
    printf("
");

    exit(EXIT_SUCCESS);
}
Comment

array of strings in c

char ch_arr[3][10] = {
                         {'s', 'p', 'i', 'k', 'e', ''},
                         {'t', 'o', 'm',''},
                         {'j', 'e', 'r', 'r', 'y',''}
                     };
Comment

string array in c

char ch_arr[3][10] = {
                         "spike",
                         "tom",
                         "jerry"
                     };
Comment

c array of strings

char commands[][4] = {
        "add",
        "prn",
        "lea",
        "inc",
        "mov"
};
Comment

c array of string

char *A[] = {"Ahmet", "Mehmet", "Bülent", "Fuat"};
Comment

array of string in c

const char *a[2];
a[0] = "blah";
a[1] = "hmm";
Comment

PREVIOUS NEXT
Code Example
C :: getchar in c 
C :: continue statement in c 
C :: what is c 
C :: c break statement 
C :: class in oops 
C :: recursive in c 
C :: #0000ff 
C :: include ‘<stdlib.h’ or provide a declaration of ‘exit’ 
C :: absolute value of intel intrinsic 
C :: choose random number with weight 
C :: c memcpy array 
C :: text to hex in C 
C :: Create the static library libmy.a containing all the functions listed below: 
C :: snprintf c 
C :: open a file in from terminal 
C :: check command line input is a number in c 
C :: les fichiers en c 
C :: c read file from command line 
C :: c atoi atof 
C :: count number of items using delimiter 
C :: Answer to storing information in array 
C :: check if a number is even and bigger than or equal to 16 using bitwise 
C :: epita 
C :: Parsing using strtok 
C :: c math.h sqrt 
C :: Integer Output 
C :: how to import c data type 
C :: sscanf and sprintf in c 
C :: profile time bash script 
C :: ? : em linguagem C 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =