Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using C .
i am doing print function, my input is a long word but i can't print the output properly
in my Printfunction should print string.
i am using structure so i am using ptr -> name
name is inside the structure.
How can i input a word in array then output by using printfunction

struct{
char name;
};
typedef.....
something like this but there is no problem
the problem is only the print there
should i use any string function
i just can't print the input by using printfunction
C++
scanf("%c", &word[v]);

function(Dex ptr){
ptr -> name =word[50]
}

PRINTFunction{
printf("%s", ptr -> name);
}

how to solve it
Thanks.
The program run with no error
Posted
Updated 24-Dec-15 3:13am
v4
Comments
Andreas Gieriet 24-Dec-15 8:50am    
This is neither C nor C++ syntax. You need to show us a proper C/C++ program in order to help you. E.g. what do you mean by telling "I am using struct"?
Regards
Andi

1 solution

Use the debugger and look at exactly what you are loading into where.
Look at what value is in ptr before you access it's properties, and what is in it's name element. Also check what value v is, and where the scanned data went.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900