Quote
[Linker error] undefined reference to `__cpu_features_init'
ld returned 1 exit status
ld returned 1 exit status
So, I thought perhaps it was due to using Dev-C++ on Windows Vista. The code is an example of scopes
/*
* scope is a term used to define the visibility and lifetime
* of declared variable or function
* visibility refers ot the question from what part of the code may the variable
* be accessed?
* lifetime asks how long will it exist
* a block is a unit of code surrounded by parentheses
* a function is just blocks named
* you can have blocks within a block
* blocks are loaded onto the stack
* variables can only be declared at the beginning of a block
* variables are only visible in the block it is declared
* or any of its sub-blocks
* when the block is completed, variable is destroyed
* scope of a global variable is all blocks
* two vars can be declared with same name
* as long as they aren't in the same block
*/
#include <stdio.h>
int a = 1;
int funct()
{
int b = 2;
a = b;
{ /* begin a block */
int c = 3;
a = b + c;
}
a = b;
{ /* begin another block */
int d = 4;
a = b + d;
}
a = b;
}
main()
{
int e = 5;
a = e;
{ /* begin a block */
int f = 6;
a = e + f;
{
int g = 7;
a = e + f + g;
}
a = e + f;
}
a = e;
}


Sign In
Create Account



Back to top









