| | |
C pointer
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
1
#2 26 Days Ago
•
•
•
•
Hi,
Could anyone please explain how the memory allocatio is done in case of double pointers?
int var = 10 ;
int *pvar = &var;
int **ppvar = &pvar;
here
var is 10. and this will be stored in some memory say that is 1000 (i.e &var =1000)
so
var =10
&var =1000
to store
&var we need a pointer ,so we declared variable
pvar then stored &var 1000 in thatso
pvar = 1000
now pvar is also a variable it also stores at some location
say that is 2000
&pvar = 2000
now i want to store the address of a poiner variable i require a pointer to pointer .
so i declared ppvar
hence
ppvar =&pvar,
now
ppvar is also a variable so it also gets some memory so lets say that is 3000
so
ppvar = 2000
&ppvar = 3000
now if i want to access either var or pvar i can do that by using ppvar
say
printf(" %u",var);
printf(" %u\n",*pvar);
printf(" %u\n",**ppvar);
all gives you only 10
printf(" %u\n",&var);
printf(" %u\n",ppvar);
printf(" %u\n",*ppvar);
gives you 1000
printf(" %u\n",&ppvar);
printf(" %u\n",ppvar);
gives you 2000
printf(" %u\n", &ppvar);
gives you 3000.
the results may vary taken just for simplicity
Minds are like parachutes - they only work when they are open
Gaiety
Gaiety
•
•
Join Date: Oct 2009
Posts: 50
Reputation:
Solved Threads: 3
0
#4 24 Days Ago
•
•
•
•
Thanks for the reply.Its clear now.I want to build a small project in c which includes both graphics and pointer concepts using LINUX OS.Could you please let me know how can i proceed on this?
pointers and graphics:
no good idea:
may be you can start learning ncurses and try with them
•
•
Join Date: Oct 2009
Posts: 50
Reputation:
Solved Threads: 3
0
#8 19 Days Ago
Thank you so very muchhh manutm..
its really good.
is it like the gstreamer or any way diffrent? which is most popular and has high demand in terms of job opportunities.
•
•
Join Date: Jul 2009
Posts: 17
Reputation:
Solved Threads: 1
0
#9 18 Days Ago
SDL is mainly for game development (and sometimes for other multimedia stuff as well) and is quite popular I think. Now, it depends on what kind of job you are looking for... If you are interested in making applications with GUI under Linux, I think GTK is very good. For 3D stuff, OpenGL is probably a "must-known", etc...
![]() |
Similar Threads
- Function Pointer (C++)
- *Pointer program problem. (C++)
- How to access a Public Pointer value of a class directly? (C++)
- pointer to member? (C++)
- pointer to some code (C++)
- pointer (C)
- Assign content to a function pointer (C)
- Change Out Your Pointer Scheme (Windows tips 'n' tweaks)
Other Threads in the C Forum
- Previous Thread: I need 2d array program
- Next Thread: Avegare number of comparisons
| Thread Tools | Search this Thread |
* adobe api array arrays bash binarysearch calculate centimeter char cm convert copyanyfile copypdffile createcopyoffile createprocess() csyntax directory dynamic fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hardware highest homework i/o ide inches initialization intmain() iso km linked linkedlist linux linuxsegmentationfault list logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue multi mysql oddnumber odf open opendocumentformat opensource openwebfoundation pattern pdf performance pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition scanf scheduling segmentationfault send shape single socketprogramming stack standard strchr string strings suggestions test testautomation unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h





