473,396 Members | 2,068 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,396 software developers and data experts.

Struct not printing properly

8
......
Expand|Select|Wrap|Line Numbers
  1. typedef struct user {
  2. char login[LOGIN_SIZE];
  3. } user;
  4.  
  5. typedef struct mail {
  6. user sender;
  7. user receiver;
  8. char * body;
  9. struct mail * next;
  10. } mail;
  11.  
  12. user users[3] = {"AAA","BBB","CCC"};
  13. mail mail1;
  14. mail1.sender= users[0];
  15. printf("SENDER %s",mail1.sender);
  16.  
It prints "SENDER" and not the mail1.sender.if i make the printf like this:
printf("SENDER %c",mail1.sender); it prints SENDER A....What shall I do?
Nov 19 '07 #1
2 1241
Ganon11
3,652 Expert 2GB
mail1.sender is of type user...but you are using the %s output modifier. Should you be using that with mail1.sender.login, which is of type char[]?
Nov 19 '07 #2
sicarie
4,677 Expert Mod 4TB
EVAS-

Please check your Private Messages, accessible via the PMs link in the top right corner of the page

Thanks
Nov 19 '07 #3

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

Similar topics

0
by: Programatix | last post by:
Hi, I am working on the PrintDocument, PrintDialog, PageSetupDialog and PrintPreviewControl components of Visual Studio .NET 2003. My developement machine is running Windows XP. There are...
67
by: S.Tobias | last post by:
I would like to check if I understand the following excerpt correctly: 6.2.5#26 (Types): All pointers to structure types shall have the same representation and alignment requirements as each...
6
by: sathyashrayan | last post by:
#include<stdio.h> #include<stdlib.h> #include<string.h> struct tree { int data; struct tree *left,*right; }; void init(struct tree *node)
13
by: katysei | last post by:
I have to print several large structs to print the screen. I was wondering if thers a tool to do so automaticly struct A { int i; char * s; }
7
by: Burhan | last post by:
Hello Group: I am in the planning stages of an application that will be accessed over the web, and one of the ideas is to print a barcode that is generated when the user creates a record. The...
4
by: call_me_anything | last post by:
I have different kind of data structures in different applications. The data structures are big and complex and I would like to print the members of each struct. Can we write a generic piece of...
0
by: Linda Liu[MSFT] | last post by:
Hi Al, Based on my understanding, you have an application which prints something to printers. The problem is that the font of "OCR A Extended" cannot be printed properly on some of printers. If...
1
by: xamalek | last post by:
I was thinking that when you override a struct variable when you are subclassing the struct, then the variable in the new struct would stomp on the old one ... (i.e.) the parent variable (i) and...
4
by: Sheldon | last post by:
Hi, I have a unique case where I need an array of structs that grows and within this array is another struct that grows in some cases. I'm having trouble allocating memory. Since I have never...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.