Results 1 to 3 of 3

Thread: Unmodifiable variable even after changes in C programming

  1. #1
    Join Date
    Aug 2009
    Posts
    54

    Unmodifiable variable even after changes in C programming

    I have a small piece of code written in C language. In that code I have a variable named "k" whose value I want to modify but here is the problem. According to my program, the value of k should be changed but it doesn't changes at all. I thought of displaying the value of k after each changes so that I can keep track of its value. I noticed that after first statement and printing k, the value was 50. Now I have the statement where k changes to product of other 2 numbers and the result is assumed to be 560 but when I print k, the value remains 50. Why is that so? Why my k is unmodifiable even after changes?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Unmodifiable variable even after changes in C programming

    What are you changing global k variable or local k variable? If your global k variable is having value of 50 and if you are changing the local k value then it is not possible. A global variable is a variable that is accessible in every scope. A local variable is a variable that is given in local scope.

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Unmodifiable variable even after changes in C programming

    This could be the problem of less RAM. How of memory are having? If you have appropriate memory then it might occur if you have used too much of variable among which some are now useless but they are still not released. Try to release them by using "free ()". If this is not the case then increase your computer RAM.

Similar Threads

  1. Replies: 3
    Last Post: 08-01-2011, 06:20 AM
  2. Replies: 2
    Last Post: 28-08-2009, 07:51 PM
  3. Replies: 3
    Last Post: 25-04-2009, 11:34 AM
  4. Can we use static variable in other programming languages
    By FlayoFish in forum Software Development
    Replies: 2
    Last Post: 25-04-2009, 10:56 AM
  5. Replies: 3
    Last Post: 13-12-2008, 01:49 PM

Tags for this Thread

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
  •  
Page generated in 1,713,570,110.22976 seconds with 16 queries