c help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sekhar_ps
    New Member
    • Jun 2006
    • 28

    c help

    hi,
    can any one tell me the answer to these questions.

    1. can we make a .c file (c source file) functionality available to other files with out including this file.any mechanism is there for this one?

    2.can .obj(compiled source file in c) file can be used by other source files?

    3.can we print individual bytes in a double seperately?

    4.is there any mechanism to make structure working like a class?

    5. can we pass more than two arguments to main function?
  • D_C
    Contributor
    • Jun 2006
    • 293

    #2
    5) You can have at most two parameters. However, one parameter is an array, so it can provides as many arguments as you'd like.

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      1. with out including this file where? In the link no, it's a source file so it shouldn't be included into other files. Without including it's header, yes but it's not good practice

      2. what do you mean "used"? Can you included it no, can you link with it and call the functions in it probably.

      3.Yes just declare a char pointer at the same address as the double

      double d;
      char *p = (char *)&d;

      4.No need structures and classes already work in exactly the same way. The only difference is that default access in structs is public and in classes is protected.

      5. Yes some systems except
      int main(int argc, char **argp, char **envp);

      envp is a list of environment variables.

      Comment

      Working...