Memory allocation. Pretty simple, but I guess there might be some people here who do not know what it is...

#include<stdio.h>
#include<iostream.h>
int main()
{
    int *n = new int;
    *n=12;
    printf("n's value is %d\n",*n);
    *n=25;
    printf("n's value is %d\n",*n);
    delete n;
    printf("n was deleted\n");
    system("PAUSE");
    return 0;
}

Are you one of them?

I don't quite get what you mean? Here is just one little example... it works as intented in my compiler. If you mean that this is too simple, then yes, you are right. If you want something more complicated, tell me and I'll try my best...

If you weren't mean, then I'm sorry.

I don't quite get what you mean? Here is just one little example... it works as intented in my compiler. If you mean that this is too simple, then yes, you are right. If you want something more complicated, tell me and I'll try my best...

If you weren't mean, then I'm sorry.

What do I mean? People generally post technical questions here. If you want to post a code snippet then you should post it that way.

Edited 5 Years Ago by gerard4143: n/a

Also, since this is the C forum, using C++ commands to do the work will just confuse and frustrate anyone trying your suggestions.

A for effort, F for execution.

the code is fine and will work........do you want help with the code

The code is NOT fine. It is C++ code, not C. new and delete are C++ commands, not C, therefore, not fine!

Edited 5 Years Ago by WaltP: n/a

According to language, the code is fine.

Read the C standard. there is no new nor delete command available. Period.

This article has been dead for over six months. Start a new discussion instead.