Professional Web Applications Themes

getchar with gcc using pointers --using gcc not any other compiler - Sun Solaris

I need to make a same program to the below to getname and display it and display certain character (certain element) . #include <stdio.h> /* lesson01_creating_arrays_using_pointers.c */ main () { float array_elements[50]; int no_array_elements; int array_element_no; input_array_elements(&no_array_elements,array_elem ents); processing(no_array_elements,array_elements); display_table(&array_element_no,array_elements); } input_array_elements(no_array_e,array_e) //------------------------------------------------------ float *array_e; int *no_array_e; { char another_element; do { printf ("Enter an array element : "); scanf("%f",&array_e[(*no_array_e)]); printf ("More array_elements (y/n) : "); scanf("\n"); scanf("%c",&another_element); (*no_array_e)++; } while (another_element=='y' && (*no_array_e)<=50); } processing(no_array_e,array_e) //------------------------------------------------------ int no_array_e; float *array_e; { float total=0; int i=0; do { printf ("The array element no %d = %f\n",i,array_e[i]); total=total+array_e[i]; i++; } while ...

  1. #1

    Default getchar with gcc using pointers --using gcc not any other compiler

    I need to make a same program to the below to getname and display it
    and display certain character (certain element) .

    #include <stdio.h>
    /*
    lesson01_creating_arrays_using_pointers.c */

    main ()
    {
    float array_elements[50];
    int no_array_elements;
    int array_element_no;
    input_array_elements(&no_array_elements,array_elem ents);
    processing(no_array_elements,array_elements);
    display_table(&array_element_no,array_elements);
    }

    input_array_elements(no_array_e,array_e)
    //------------------------------------------------------
    float *array_e;
    int *no_array_e;
    {
    char another_element;
    do {
    printf ("Enter an array element : ");
    scanf("%f",&array_e[(*no_array_e)]);
    printf ("More array_elements (y/n) : ");
    scanf("\n");
    scanf("%c",&another_element);
    (*no_array_e)++;
    } while (another_element=='y' && (*no_array_e)<=50);
    }

    processing(no_array_e,array_e)
    //------------------------------------------------------
    int no_array_e;
    float *array_e;
    {
    float total=0;
    int i=0;
    do {
    printf ("The array element no %d = %f\n",i,array_e[i]);
    total=total+array_e[i];
    i++;
    } while (i<no_array_e);
    printf ("\nThe average = %f\n",(float) total/no_array_e);
    }

    display_item(array_element_n,array_e)
    //------------------------------------------------------
    int *array_element_n;
    float *array_e;
    {
    printf ("Enter an array element : ");
    scanf("%d",array_element_n);
    printf ("\nThe array element is : %f \n",array_e[*array_element_n]);
    }
    ehab Guest

  2. #2

    Default Re: getchar with gcc using pointers --using gcc not any other compiler

    ehab wrote: 
    [SNIP]

    stdio.h and all the functions in it are Microsoft propriatery, therefore off
    topic here.

    See the FAQ for the right newsgroup for your Q:
    http://www.parashift.com/c++-faq-lite/how-to-post.html#faq-5.9

    --
    Attila aka WW


    Attila Guest

  3. #3

    Default Re: getchar with gcc using pointers --using gcc not any other compiler

    Hi,


    "Attila Feher" <ericsson.se> wrote in message
    news:bl1dv8$kp4$wise.edt.ericsson.se... 
    > [SNIP]
    >
    > stdio.h and all the functions in it are Microsoft propriatery, therefore[/ref]
    off 

    Attila?

    printf() is one of those evil Microsoft things?

    Anybody home?

    To the OP:

    your question is perfectly on-topic, <stdio.h> is a standard header.

    HTH,
    Stefan.


    Stefan Guest

  4. #4

    Default Re: getchar with gcc using pointers --using gcc not any other compiler

    Stefan Höhne wrote: 
    >> [SNIP]
    >>
    >> stdio.h and all the functions in it are Microsoft propriatery,
    >> therefore off topic here.[/ref]
    >
    > Attila?
    >
    > printf() is one of those evil Microsoft things?
    >
    > Anybody home?
    >
    > To the OP:
    >
    > your question is perfectly on-topic, <stdio.h> is a standard header.[/ref]

    :-)))) Time for the weekend.

    --
    Attila aka WW


    Attila Guest

  5. #5

    Default Re: getchar with gcc using pointers --using gcc not any other compiler

    Attila Feher wrote: 
    [SNIP] [/ref]
    [SNIP] 

    Meaning that I swear I read conio.h... And I did not drink. I only used
    Rational RoseRT today. But I washed my hands afterwards. :-( I am already
    afraid to say "I won't get any more stupid"... I have already surprised
    myself...

    Sorry to the OP.

    --
    Attila aka WW


    Attila Guest

  6. #6

    Default Re: getchar with gcc using pointers --using gcc not any other compiler

    Hi,

    "ehab" <com> wrote in message
    news:google.com... 

    I've got to change my mind regarding the on-topicness off
    your question.

    You should post to comp.sources.wanted for questions like that.
    This NG is not a magic code-generator.

    What is your actual problem in making such a program
    yourself?

    Stefan.

    [lengthy code snipped]

    PS: Its better to post code without using tabs, only
    spaces for the formatting. Some Newsreaders (e.g.
    OE) just ignore tabs, making your code hard to read.


    Stefan Guest

  7. #7

    Default Re: getchar with gcc using pointers --using gcc not any other compiler

    ehab wrote:
     

    So let's try it again, now from SUSE-Linux, maybe as a Linux user I will not
    be so stupid.

    I was reading the question and the code... and I start to get the feeling
    that this is a homework assignment. Even if it is not, could you please
    show what you came up with so far? Or what exactly is your problem? Not
    the assignment in general, that is something you need to solve. I meant
    that you have tried to solve it but... so what comes after but?

    Attila Guest

  8. #8

    Default Re: getchar with gcc using pointers --using gcc not any other compiler

    Stefan Höhne wrote: 

    Not only OE, also KNode (KDE news thingy)
    Attila Guest

Similar Threads

  1. Pointers on how to do the following
    By Jay in forum PHP Development
    Replies: 2
    Last Post: January 10th, 10:21 PM
  2. Pointers
    By Eric Walker in forum PERL Beginners
    Replies: 11
    Last Post: November 22nd, 04:10 PM
  3. Replies: 8
    Last Post: November 10th, 08:52 PM
  4. POSIX::getchar
    By John Fisher in forum PERL Beginners
    Replies: 2
    Last Post: September 12th, 01:32 PM
  5. Replies: 0
    Last Post: July 21st, 10:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139