Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void allocate(unsigned int size1, unsigned int size2) {
- // char array[size1][size2]; // Not possible
- // Now, i need to allocate space in memory for that "array"
- char *array = malloc(size1*size2); // This will allocate enough space
- // But i need to access to each element like if it was a fixed array
- // Like:
- // strcpy(array[0], "Hello world!");
- }
- int main(int argc, char **argv) {
- allocate(atoi(argv[1]), atoi(argv[2]));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement