Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. const keyword

const keyword

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lavanya81
    wrote on last edited by
    #1

    Hi, I am new to this forum>plz let me know which forum is suitable for 'C' language. And my question is - What are the possible ways of writing C codes using 'const' keyword. I have written some.I need few more. Plz go thru and send me any other cases where we can use const keyword in C only not C++.Hope I will get reply as early possible. const int degrees = 360; int const degrees1 = 180; const float pi = 3.14; const char quit = 'q'; int * const var1; const int * var2; int const * var3 const char * const Var4; char const * const Var5; void test1() const; const int * test2(); /* function returns a adress that could not be modified */ void test3(const int *i); const int arr1[]={1,2,3,4,5,6,7}; char const *arr="coderzone"; typedef struct member { char name[20]; long phno; }; const struct member M1 = {"Marino" , 62627000}; struct member * const M2 = {"John" , 2786900}; const struct member * const M3 = {"Smith",57361777}; union single { int I1; char C1; }; const union single S1 = {97}; union single * const S2 = {'A'}; const union single * const S3 = {'0'}; Thank U..

    S T 2 Replies Last reply
    0
    • L lavanya81

      Hi, I am new to this forum>plz let me know which forum is suitable for 'C' language. And my question is - What are the possible ways of writing C codes using 'const' keyword. I have written some.I need few more. Plz go thru and send me any other cases where we can use const keyword in C only not C++.Hope I will get reply as early possible. const int degrees = 360; int const degrees1 = 180; const float pi = 3.14; const char quit = 'q'; int * const var1; const int * var2; int const * var3 const char * const Var4; char const * const Var5; void test1() const; const int * test2(); /* function returns a adress that could not be modified */ void test3(const int *i); const int arr1[]={1,2,3,4,5,6,7}; char const *arr="coderzone"; typedef struct member { char name[20]; long phno; }; const struct member M1 = {"Marino" , 62627000}; struct member * const M2 = {"John" , 2786900}; const struct member * const M3 = {"Smith",57361777}; union single { int I1; char C1; }; const union single S1 = {97}; union single * const S2 = {'A'}; const union single * const S3 = {'0'}; Thank U..

      S Offline
      S Offline
      Shouvik Das
      wrote on last edited by
      #2

      There is nothing better than a paper and ink bounded book to learn C or in that case any programming language. To start with C please use the The C Programming Language by Schaum Series and move onto The C Programming Language by Dennis Richie and Brian W Kerningham, Pearson Education Publication. But if you still insist on online Sites, best would be to Google the keyword and choose the best site upto your understanding.


      There are only two kinds of people who are really fascinating-people who know absolutely everything, and people who know absolutely nothing. Oscar Wilde (1854-1900) Regards... Shouvik

      1 Reply Last reply
      0
      • L lavanya81

        Hi, I am new to this forum>plz let me know which forum is suitable for 'C' language. And my question is - What are the possible ways of writing C codes using 'const' keyword. I have written some.I need few more. Plz go thru and send me any other cases where we can use const keyword in C only not C++.Hope I will get reply as early possible. const int degrees = 360; int const degrees1 = 180; const float pi = 3.14; const char quit = 'q'; int * const var1; const int * var2; int const * var3 const char * const Var4; char const * const Var5; void test1() const; const int * test2(); /* function returns a adress that could not be modified */ void test3(const int *i); const int arr1[]={1,2,3,4,5,6,7}; char const *arr="coderzone"; typedef struct member { char name[20]; long phno; }; const struct member M1 = {"Marino" , 62627000}; struct member * const M2 = {"John" , 2786900}; const struct member * const M3 = {"Smith",57361777}; union single { int I1; char C1; }; const union single S1 = {97}; union single * const S2 = {'A'}; const union single * const S3 = {'0'}; Thank U..

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        what is the final goal behind this question please ? const only means that the variable/object to which it is declared cannot be modified once initialized.


        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups