Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to use *int and malloc and 'sizeof'

0 votes
asked Apr 11, 2020 by aakisety svakrishna (120 points)

1 Answer

0 votes
answered Apr 27, 2020 by chn (240 points)

You may ask something like this:

int* i = (int*)malloc(sizeof(int)); 

This line of code allocs a space from RAM with size of the given type --in this case integer and it's size 4 bytes--. It doesn't assign a value to this pointer value, it leaves the existing value. 

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...