vishwajith-k / gist Goto Github PK
View Code? Open in Web Editor NEWC faq
C faq
Ans - No. Size of the data-type is yet not known so you can not do that, even if you try using typedef
. GCC complains saying incomplete type.
a << -10
)sizeof(a) == 32 && a << 33
)Why do we need int8_t
when we are sure that char
consumes same size? Or for that matter why do we need stdint.h
itself?
Ans - Till now char
on C consumes 1B. But what about int
? It varies across machines! So, if you definitely need 32b for your data, then pick uint8_t
or int32_t
instead of C's keyword based types. With this kind of usage, code change is not required across machines. So the purpose of these types is that, portability. And one more noticeable point is that, these words end with t
; which simply means type
or typedef
.
Yes. But may not be achievable in single file. If an identifier is used, it must first be declared/defined earlier. That's not the case with typedef
. A type can be aliased to another type even if the first type (that is being aliased) doesn't exist earlier. Compilation succeeds, except some kind of clarification may be needed to run the code. This usage yields opaqueness for a given type. And limits user to use the provided abstraction layer (typically getter, setter) and not the underlying data.
Ans - It depends. Rule - Whenever we try to access something, locals are checked first (afais-een). If enum
value and variable are in same scope, then an error is guarantied. But they are in different scopes, then no (compiler) errors for this reason; but you may expect the unexpected behaviors; while coding you may think that you're trying to access a global variable or global enum
value, it might have picked local enum
value or variable with same name. To avoid this issue, enum
are (most-ly ๐ค) suffixed with _e
in standard headers. Like in the case of datatypes being appended with _t
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.