Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
char * blah[];
char ** blah;
char blah[][];
int main(int argc, [green]char** argv[/green])
int main(int argc, [green]char * argv[][/green])
int main(int argc, [green]char argv[][][/green])
#include <memory.h>
#include <string.h>
#define DIM_ONE_SIZE 10
#define DIM_TWO_SIZE 256
int main(){
int i;
//Allocate dimension one
char** multiDimArray =
calloc (DIM_ONE_SIZE, sizeof(char*));
//Allocate dimension two
for(i=0; i<DIM_ONE_SIZE; i++)
multiDimArray[i] = calloc (DIM_TWO_SIZE, sizeof(char));
//Assign cells
strcpy(multiDimArray[0], "hell");
strcpy(multiDimArray[1], "goodbye");
multiDimArray[0][4] = 'o';
multiDimArray[0][5] = '\0';
//Print cells
printf("%s\n", multiDimArray[0]);
printf("%s\n", multiDimArray[1]);
//Free heap memory
for(i=0; i<DIM_ONE_SIZE; i++)
free(multiDimArray[i]); // free pointers to
// strings.
free(multiDimArray); // free pointer to array
// of (now deallocated)
// pointers.
return 0;
}
> hello
> goodbye
#include <memory.h>
#include <string.h>
#define DIM_ONE_SIZE 10
#define DIM_TWO_SIZE 256
int main(){
int i;
char multiDimArray[DIM_ONE_SIZE][DIM_TWO_SIZE];
//Assign cells
strcpy(multiDimArray[0], "hell");
strcpy(multiDimArray[1], "goodbye");
multiDimArray[0][4] = 'o';
multiDimArray[0][5] = '\0';
//Print cells
printf("%s\n", multiDimArray[0]);
printf("%s\n", multiDimArray[1]);
return 0;
}