what compiler that change all variable in one occurrence?

This is a discussion on what compiler that change all variable in one occurrence? within the C Programming forums, part of the General Programming Boards category; what compiler that change all variable in one occurrence?...

  1. #1
    Registered User
    Join Date
    Dec 2012
    Posts
    39

    what compiler that change all variable in one occurrence?

    what compiler that change all variable in one occurrence?

  2. #2
    Registered User
    Join Date
    Nov 2012
    Posts
    1,053
    Could you clarify what you mean by changing all variables "in one occurence"? For example, if x, y and z are integers, you can write the following in legal C. It doesn't matter what compiler you use.

    Code:
    x = y = z = 0;

  3. #3
    Registered User
    Join Date
    Dec 2012
    Posts
    39
    Example
    Code:
    #include<stdio.h>
    void main()
    {
      int x;
     scanf("%d", &x);
     printf("%d", x);
    }
    If I change the variable x to y in line 4. It automatically change the variable x in line 5 and 6 to y.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by programmerc View Post
    Example
    Code:
    #include<stdio.h>
    void main()
    {
      int x;
     scanf("%d", &x);
     printf("%d", x);
    }
    If I change the variable x to y in line 4. It automatically change the variable x in line 5 and 6 to y.
    They all will - but there is a box to check, marked "whole word only", and another one to enable a change of ALL the target values throughout the program.

    And finally, there is an option for the direction you want the search to be done in, and whether it will "wrap" back around to the current location, or not, when taking this action.

    So check your options.

  5. #5
    Registered User
    Join Date
    Nov 2012
    Posts
    1,053
    This function is called "Replace..." or "Find and Replace..." and is available in most text editors. Each one does it a little bit differently. For example in CodeBlocks there is the option to do the replacement on all open files, which is nice. And you should also "Match case" as well as "whole word only" because C is case-sensitive. If you want to rename x to y, then you wouldn't want to inadvertently rename X to y

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    > what compiler that change all variable in one occurrence?
    As c99tutorial says, this is a function of your code editor, not your compiler.

    A compiler just READS your source text file, and translates it through a number of steps into some kind of executable program.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to know when a value of a variable change?
    By Hannibal2010 in forum C Programming
    Replies: 12
    Last Post: 11-25-2011, 01:16 PM
  2. Doesn't consider change in variable
    By f0xy in forum C Programming
    Replies: 5
    Last Post: 10-29-2011, 08:33 AM
  3. Can't change variable from another function...
    By Ryan. in forum C Programming
    Replies: 9
    Last Post: 03-10-2011, 11:10 PM
  4. Replies: 4
    Last Post: 02-28-2011, 06:57 AM
  5. How to change compiler in devC++?
    By MelaOS in forum C++ Programming
    Replies: 1
    Last Post: 01-21-2004, 11:31 PM

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