I need to know some basic issues

This is a discussion on I need to know some basic issues within the C Programming forums, part of the General Programming Boards category; Hi all, I am new in C programming and I need to know some basic issues my questions are shown ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    130

    I need to know some basic issues

    Hi all,

    I am new in C programming and I need to know some basic issues
    my questions are shown within the code:

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    
    void put(char arr[]){
          int k=0;
          while(k!=1000){// I want to say while(k!=arr size())
          for(; k<=d; k++){
             char ch = arr[k];
             if(ch==0) break;
             putchar(ch);}
          k=k+1;
          d=d+2;
    }
    }
    How to pass the array from the obove function to other function

    Thankx

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Code:
    while(k!=1000){// I want to say while(k!=arr size())
    Pass the array size as a parameter to the function.
    How to pass the array from the obove function to other function
    The same way you call put.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    130
    I don't want to limit the size of array to certain value, I want to do as what we do in java if that could of course

    Thanks

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    130
    Sorry for that,
    But if I passed the array size as a parameter, then I will need to use some thing like (arr aize) in the other function, since I will deal with file that stores the chars to array and call the previous function and do something until it reachs the array size.

    In this case the size of the array vary according to the file and I don't know how to deal with array size

  5. #5
    Even death may die... Dante Shamest's Avatar
    Join Date
    Apr 2003
    Location
    Malaysia
    Posts
    970
    Quote Originally Posted by Moony
    But if I passed the array size as a parameter, then I will need to use some thing like (arr aize) in the other function
    Rewrite that function to take a arrayLength parameter as well.

    Quote Originally Posted by Moony
    In this case the size of the array vary according to the file and I don't know how to deal with array size
    Lookup malloc(), calloc() and free().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [ANN] New script engine (Basic sintax)
    By MKTMK in forum C++ Programming
    Replies: 1
    Last Post: 11-01-2005, 09:28 AM
  2. what are your thoughts on visual basic?
    By orion- in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-22-2005, 04:28 AM
  3. visual basic vs C or C++
    By FOOTOO in forum Windows Programming
    Replies: 5
    Last Post: 02-06-2005, 07:41 PM
  4. Issues
    By Tamandt in forum C++ Programming
    Replies: 22
    Last Post: 09-10-2004, 11:42 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21