由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - C/C++ Questions
相关主题
[C++]请问哪些变量在heap创建?一个电面
c++ 问题: 用static local variables 还是 pass by reference请教一个C/C++问题
请教一个storage class的问题difference between static used in c and c++
一个简单的java问题Amazon一道synchronization的面试题
question about static variablewrite singleton w/o using static variable or function
攒rp,电面题目请教个C++编程思路
问一个static variable上锁的问题问道编程题
问2个BB面试问题bloomberg 第一轮电话面试 电经
相关话题的讨论汇总
话题: static话题: variable话题: c++话题: what话题: questions
进入JobHunting版参与讨论
1 (共1页)
c**********e
发帖数: 2007
1
What are static variable and static function?
What is the difference between static variable and global variable?
c***g
发帖数: 472
2

There are three situations for static
1 static non-local variable/function
2 static local variable
3 static class variable/function (only in C++)
1 static non-local variable is similar to global variable. The difference is
global variable can be accessed by other unit. The static variable can only
be accessed in the same unit.
2 static local variable and static class variable are totally different from
global variable.

【在 c**********e 的大作中提到】
: What are static variable and static function?
: What is the difference between static variable and global variable?

l*******y
发帖数: 1498
3
A static variable is a variable that has been allocated statically — whose
lifetime extends across the entire run of the program.
1. Static global variables are declared as "static" at the top level of a
source file. Such variables are not visible outside the source file ("file
scope"), unlike variables declared as "extern".
2. Static local variables are declared inside a function. They have the same
scope as normal local variables, differing only in "storage duration":
whatever values the funct
N*******k
发帖数: 43
4
我也被问这个问题了。回答得理论了些,说 compilation 啥的,对方不满,说,我关
心的是如何用,什么时候用,做什么用。

【在 c**********e 的大作中提到】
: What are static variable and static function?
: What is the difference between static variable and global variable?

z****e
发帖数: 2024
5
C++:
1. static member function does not have this pointer. So can not access non-
static class members.
2. one doesn't need to instantiates an object to call the static member
function. It only reserves the name scope.
1 (共1页)
进入JobHunting版参与讨论
相关主题
bloomberg 第一轮电话面试 电经question about static variable
请问一下啥是static/dynamic heap?攒rp,电面题目
回馈本版,贴ms onsite面经问一个static variable上锁的问题
One C++ question问2个BB面试问题
[C++]请问哪些变量在heap创建?一个电面
c++ 问题: 用static local variables 还是 pass by reference请教一个C/C++问题
请教一个storage class的问题difference between static used in c and c++
一个简单的java问题Amazon一道synchronization的面试题
相关话题的讨论汇总
话题: static话题: variable话题: c++话题: what话题: questions