Skip to content

Instantly share code, notes, and snippets.

@mingliangguo
Last active September 28, 2020 02:24
Show Gist options
  • Save mingliangguo/30b2510bdae82f53785a1effb0ccb8a0 to your computer and use it in GitHub Desktop.
Save mingliangguo/30b2510bdae82f53785a1effb0ccb8a0 to your computer and use it in GitHub Desktop.
C cheatsheet #c #array #pointer
# dynamically allocate a 2d array in C
#define maxlinelength 10
char (*lines)[maxlinelength] = malloc( sizeof( char[maxlinelength] ) * numlines ) ;
lines[0][0] = 'A' ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment