User Profile

Collapse

Profile Sidebar

Collapse
raddmadd
raddmadd
Last Activity: Aug 27 '08, 05:27 PM
Joined: Mar 17 '08
Location: US
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • raddmadd
    replied to File operations in C
    in C
    fwrite()
    fread()
    fopen()
    fclose()
    fseek()
    getc()
    putc()
    fscanf
    fprintf

    are some ones you should check into. And then there's the ones included in the original language, but not ANSI.

    Also check out Open Group's website for info on functions, such as:

    http://www.opengroup.org/onlinepubs/...s/stdio.h.html...
    See more | Go to post

    Leave a comment:


  • raddmadd
    started a topic Character Arrays in C
    in C

    Character Arrays in C

    I understand simple character arrays; however I do not understand this code example in the K & R book:

    Code:
    #include <stdio.h>
    #define MAXLINE 1000    /* maximum input line length */
    
    int getline(char line[], int maxline);
    void copy(char to[], char from[]);
    
    /* print the longest input  line */
    main()
    {
        int len;             /* current line length */
    ...
    See more | Go to post

  • raddmadd
    replied to C functions and data types
    in C
    Well, what I was talking about in the second paragraph is...

    For instance in this program, we have fahr (line 16) declared as int. But say for instance, in line 11, if that variable a was a variable of type float. What happens? I really don't understand entering variables as the argument.

    I picture it like this, the variable a's value is now stored in fahr, and converted to the type of fahr (if its a different data...
    See more | Go to post

    Leave a comment:


  • raddmadd
    replied to C functions and data types
    in C
    Thanks for the reply friend.

    Well, I don't understand functions fully. If I use the return statement to return a variable as type int to a function that is for instance type float, what happens? It is converted? Why do we even declare a function to be any data type? Do we declare them as a data type so that it knows how to store the value the return statement gives it?

    Also, I don't understand parameters for functions....
    See more | Go to post

    Leave a comment:


  • raddmadd
    started a topic C functions and data types
    in C

    C functions and data types

    I guess I don't fully understand the way functions in C work.

    For instance, I'll use this program as an example:

    Code:
    #include <stdio.h>
    
    float celsius(int);
    
    main()
    {
    
    	int a;
    
    	for(a  = 0; a <= 300; ++a)
    		celsius(a);
    
    	return 0;
    }
    
    float celsius(int fahr)
    {
    	int a, b;
    ...
    See more | Go to post
No activity results to display
Show More
Working...