Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6569393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:37:16+00:00 2026-05-25T14:37:16+00:00

UPDATED: I found the bug, single quotes wrong. Replaced it by double quotes and

  • 0

UPDATED:

I found the bug, single quotes wrong. Replaced it by double quotes and worked fine. Sorry for the inconvenience but caught it soon.

===========================================================================

This is a simple example of what should be a structure declaration and access to its data, but I get a list of errors complaining that the “character constant is too long for its type” and also “passing of argument 1 in printf makes pointer from integer without a cast”. So, the program crashes with overflow stuff. Nombre is first name, apellido is last name, and edad is age. Was trying to gather all that in a structure and the print the results accessing them through a pointer. (Why do I have to access them through a pointer and not simply by the dot notation?)

#include <stdio.h>
#include <stdlib.h>

struct estructura_amigo {
 char nombre[30];
 char apellido[40];
 char telefono[10];
 int edad;
 };
struct estructura_amigo amigo = {
 'Juanjo',
 'Lopez',
 '592-0483',
 30
 };
struct estructura_amigo *p_amigo;
int main()
 {
 p_amigo = &amigo;
 printf( '%s tiene ', p_amigo->apellido );
 printf( '%i años ',  p_amigo->edad );
 printf( 'y su teléfono es el %s.\n' ,  p_amigo->telefono );
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:37:17+00:00Added an answer on May 25, 2026 at 2:37 pm

    Use double quotes, like this

    printf( "%s tiene ", p_amigo->apellido );
    

    In C single quote = char, double quote = string.

    And

    printf( "%s tiene " , amigo.apellido );
    

    should work, no need to get a pointer to the struct.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have no idea if I just found a potential jQuery bug, but check
Since I updated jQueryUI to 1.8 I found a couple of issues in our
I recently updated my Eclipse (now running 20100218-1602), and I've found whenever I click
UPDATE - A comprehensive comparison, updated as of February 2015, can be found here:
I found a threadpool which doesn't seem to be in boost yet, but I
I found a bug in an application that completely freezes the JVM. The produced
I found a bug in the Contains statement in Linq (not sure if it
I have updated an application from Delphi 2007 to Delphi 2010, everything went fine,
I just found a possible bug in Firefox 6 for Windows. When I try
I've found a pretty nasty bug in EF 4.1 Code First. Assume we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.