c - two arguments of arry and read the columns -


i have simple tab:

int rows = atoi(argv[1]); int tab[rows][2]; 

and i'm forwarding func by:

myfunc(tab); void myfunc(int (*tab)[2]); 

how can read number of rows? still try about:

int readrowinmyfunc = sizeof(tab)/(sizeof(int **)); 

but doesn't work.

sizeof(tab) = rows * 2 * sizeof(int) 

so

rows = sizeof(tab) / (2*sizeof(int)) 

note bad idea create array on stack dynamic size. if run program argv[1] = 100000000000000000000?


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -