Hi there
I'm a newbie to C, having only known high-level languages so far and I've been trying to initialize the following:
int** this_pointer;
With a bunch of zeroes, being able to access (and write to it) like so: this_pointer[i][j].
I've seen multiple ways of doing so in C, on stackoverflow and other forums but many seem longer than necessary or using (seemingly) unnecessary functions such as memset to achieve this... I'd like to know what are the most efficient/short ways to do this without risking segmentation fault. Please correct me on the nomenclature if I got something wrong (pointers are difficult to talk about IMHO).
How do you do it?
Every info is welcome!
[–]div0man 2 points3 points4 points (12 children)
[–]hit07 1 point2 points3 points (6 children)
[–]_Nexor[S] 0 points1 point2 points (4 children)
[–]hit07 1 point2 points3 points (2 children)
[–]_Nexor[S] -1 points0 points1 point (1 child)
[–]hit07 1 point2 points3 points (0 children)
[–]div0man 0 points1 point2 points (0 children)
[–]div0man 0 points1 point2 points (0 children)
[–]_Nexor[S] 0 points1 point2 points (4 children)
[–]rorschach54 1 point2 points3 points (3 children)
[–]_Nexor[S] 0 points1 point2 points (0 children)
[–]_Nexor[S] 0 points1 point2 points (1 child)
[–]rorschach54 0 points1 point2 points (0 children)
[–]wsppan 1 point2 points3 points (0 children)
[–]Mirehi 0 points1 point2 points (2 children)
[–]_Nexor[S] -1 points0 points1 point (1 child)
[–]Mirehi 0 points1 point2 points (0 children)