troubleshooting Question

program 5

Avatar of huffjon
huffjon asked on
C
5 Comments1 Solution239 ViewsLast Modified:
writing a program that accept a floating point number, an interger and a character.  then calls a function that puts all of the data in a single string.  here is what I ahve.

#include <stdio.h>

void getline(char []);

int main ()
{
      char stuff[90];
      int i;
      char numblah;
      char junk;

      printf("Enter a number");
      scanf ("%f", &i);
      printf("Enter a chatacter");
      scanf ("%f", &junk);
      printf("Enter a interger");
      scanf ("%f", &numblah);

      getline(stuff);

      printf("\nthe string you just entered is:\n");
      puts(stuff);

      return 0;
}

void getline(char string[])
{
      int i = 0;
      char c;

      while ( i < 89 && (c = getchar()) != '\n')
      {
            string [i] = c;
            ++i;

      }
      string [i] = '\0';
      return;
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros