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

allocate a array on strings in c

char **strs;
int num_of_strs = 10;

strs = malloc (sizeof(char *) * num_of_strs );
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 :: Rounding Floating Point Number To two Decimal Places in C 
C :: set the nth bit 
C :: casting in c 
C :: replace a substring with another substring in c 
C :: Leap year using function in c 
C :: Program to Check Whether Character is Lowercase or Not without using islower function 
C :: debian unhold packages 
C :: imprimir matriz 
C :: how to select numeric columns in r 
C :: do while loop in c 
C :: sleep in c 
C :: how to print % in c 
C :: strstr 
C :: working outside of application context 
C :: script in c 
C :: static variable c 
C :: declare an array 
C :: convert python to c 
C :: gandhi ashram saharanpur 
C :: data-types 
C :: How can you invoke the constructor from the parent class? *ruby 
C :: how to change the mapping from jkil to wasd in vim 
C :: C access global variable same name 
C :: VLOOKUP CHECK #N/A 
C :: check if string is number c 
C :: Reverse every Word of given String 
C :: networkx remove attributes 
C :: wait system call 
C :: print hello world c 
C :: function of science writing of a number 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =