I know this is a very basic problem, but I cannot move forward without it and its not clearly explained elsewhere.
Why is this programming giving me so many errors of undeclared identifier? I have declared it, though.
These are the error i am getting.
Error   2   error C2143: syntax error : missing ';' before 'type'
Error   3   error C2065: 'ptr' : undeclared identifier
Error   4   error C2065: 'contactInfo' : undeclared identifier
Error   5   error C2059: syntax error : ')'
Error   15  error C2223: left of '->number' must point to struct/union
and more...
#include<stdio.h>
#include<stdlib.h>
typedef struct contactInfo
{
    int number;
    char id;
}ContactInfo;
void main()
{
    char ch;
    printf("Do you want to dynamically etc");
    scanf("%c",&ch);
    fflush(stdin);
        struct contactInfo nom,*ptr;
        ptr=(contactInfo*)malloc(2*sizeof(contactInfo));
    nom.id='c';
    nom.number=12;
    ptr->id=nom.id;
    ptr->number=nom.number;
    printf("Number -> %d\n ID -> %c\n",ptr->number,ptr->id);
}
 
     
     
     
     
     
    