Array Related Doubt.......

Posted by AGeek on Stack Overflow See other posts from Stack Overflow or by AGeek
Published on 2010-06-13T15:10:10Z Indexed on 2010/06/13 15:12 UTC
Read the original article Hit count: 158

Filed under:
|

I have the following program...........

int insert(int *array, int arraySize, int newElement)
{
   array[arraySize + 1] = newElement;
   return (arraySize+1);     // Return new Array size......
}
int main()
{
   int array[] = {1,2,3,4,5};
   int arraySize = sizeof(array) / sizeof(int);

   insertInArray(array, arraySize,6);
   print(array);
}

I am trying to work out this program in C programming language... But when i print the array after insertion,,, it doesn't prints the desired output which is needed..

Please correct me if i am doing something wrong.....

Thanks..

© Stack Overflow or respective owner

Related posts about c

    Related posts about arrays