473,378 Members | 1,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

printf is not working as excpected

8
typedef struct mail {
user sender;
user receiver;
char body[100];
struct mail * next;
} mail;

mail1.body= {"this is the body of the message"};
printf("Body: %s",mail1.body);


I have a compiler error.Can you tell me pls where is it?
Nov 20 '07 #1
3 1636
debasisdas
8,127 Expert 4TB
Hi EVAS

Welcome to TSDN.

Feel free to post questions in the related forum only by choosing from under the blue bar on the top of your page.

Please follow the posting guidelines in every new post/reply.

Please specify your post/question clearly.Please use proper code tags in all your codes.

Regards

Debasis
Nov 20 '07 #2
sicarie
4,677 Expert Mod 4TB
I would recommend reading the error message - it's in there, that's what the message is for. If you are having trouble with the error message, post it and we will help you disseminate it.
Nov 20 '07 #3
AHMEDYO
112 100+
HI..

yes man try to post your error message with your code, but i think you have more than 1 error within your code, first you was define your structure with "mail" name and then with the structure typedef name is "mail" you must make different between names like that

Expand|Select|Wrap|Line Numbers
  1.  typedef struct _MAIL 
  2. {
  3. var list..
  4. } MAIL; //this is not variable because you specify "typedef" KEYWORD
  5.  
second you specify "user sender;" and recevier within your structure and you didnt give us what "user" type is???.

finally :you cannot use this line ,try to use pointer type instead

Expand|Select|Wrap|Line Numbers
  1. mail1.body= {"this is the body of the message"};
  2.  

Best Reagards
Nov 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Steven T. Hatton | last post by:
OK, I take back the nasty stuff I said about printf. At least until I see a similarly concise way of writing this using C++ formatters. I want to convert the following to something I can put onto...
2
by: Paul E Johnson | last post by:
Dear friends in C: I'm completely baffled by this problem I have with printf statements and conditional operators in C. I'm using gcc-3.3. I have a project where the rarely used Union type...
6
by: Dawn Minnis | last post by:
Hi (running Win xp and developing using Miracle C. Running applications in windows command prompt) I'm new to the group so be gentle with me. I am currently writing a C program to perform...
8
by: Gregc. | last post by:
Hi Sorry to bother you gusy with such a basic question, but I am working on a conversion program. I've got most of it down, but I am having trouble with the output: *Dollar Conversion...
28
by: dutche | last post by:
Hi, there is some kind of difference in these two statements? float num = 154.87; printf("There is : $0.0f",num); and float num = 154.87;
19
by: RedDevilDan | last post by:
I am working on a Memory Footprint Reduction project. I came across an idea to disable all printf statements so that less memory is required. In addition, when there is no single printf statement,...
5
by: Dave | last post by:
Hi, In awk I can do this: var1="x"; temp = sprintf("Variable 1: %s Variable 2: %%s", var1); # now the value of temp is "Variable 1: x Variable 2: %s" var2="y"; printf(temp,var2);
2
by: rameshbabupeddapalli | last post by:
Hi, I want to create my own variable length parameters function it should work like printf() function. When i write the program as given below it's working fine #include<stdio.h> ...
9
by: tvnaidu | last post by:
I am doing floating point calculation inside C function, with debugger I can see float values in single step, if I want to print them on console, I am using printf, but printf not working for flaot,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.