Sponsored Content
Full Discussion: sizeof
Top Forums Programming sizeof Post 86196 by ramneek on Wednesday 12th of October 2005 02:38:07 AM
Old 10-12-2005
but i am getting the result as zero

my program is like this


struct foo
{
char c[];

};


void main()
{
struct foo s;
cout<<sizeof(s);
}



when i compile this and run on solaris 5.8 it gives the output as 0
i dont know why

there is no error in my compilation
 

6 More Discussions You Might Find Interesting

1. Programming

sizeof an array of structure without using 'sizeof' operator

Hi All, is it possible to find out the size of an array of structures ( without using 'sizeof' operator). The condition is we have the array of structure instant but we are not aware of the elements inside the structure. Can someone help me out? Thanks in advance. (18 Replies)
Discussion started by: rvan
18 Replies

2. Programming

How to get the sizeof char pointer

The below code throws the error, since the size of x = 19 is not passed to the cstrCopy function. using namespace std; static void cstrCopy(char *x, const char*y); int main () { char x; const string y = "UNIX FORUM"; cstrCopy(x,y.c_str()); return 0; } void cstrCopy(char *x,... (3 Replies)
Discussion started by: SamRoj
3 Replies

3. Programming

Doubts regarding sizeof() operator

Hi, There are some bewildering sizeof() questions I have in my mind. Could anyone shed some light on this? int main() { printf("%d\n", sizeof(main)); // Ans: 1 } That is, the sizeof() a function identifier though it is treated internally as a pointer gives 1 byte always, why? ... (5 Replies)
Discussion started by: royalibrahim
5 Replies

4. Programming

sizeof(object) in C++

Hi, I have defined the class and call the sizeof(object to class) to get the size. # include <iostream> # include <iomanip> using namespace std; class sample { private: int i; float j; char k; public: sample() { } (2 Replies)
Discussion started by: ramkrix
2 Replies

5. Shell Programming and Scripting

Sizeof a file from directory path in perl

Hai how to find size of a file?? ex : /home/kiran/pdk/sample/calibre this is a path In that I have to find size of a files in side a calibre(it is the folder) like .results or .summary (1 Reply)
Discussion started by: kiran425
1 Replies

6. Programming

Compiler/Runtime uses of sizeof

Ignoring other considerations for a moment and in general ... Would there be a difference in result (dot oh or execution) of: A. strncpy( a, b, sizeof(a) ); vs. B. c = sizeof(a); strncpy( a, b, c ); My general understanding is (at least I think my understanding is) that... (10 Replies)
Discussion started by: GSalisbury
10 Replies
MixinFactory::HasAFactory(3pm)				User Contributed Perl Documentation			    MixinFactory::HasAFactory(3pm)

NAME
Class::MixinFactory::HasAFactory - Delegates to a Factory SYNOPSIS
package My::BaseClass; @ISA = 'Class::MixinFactory::HasAFactory'; sub new { ... } sub foo { return "Foo Bar" } package My::Logging; sub foo { warn "Calling foo"; (shift)->NEXT('foo', @_) } package My::UpperCase; sub foo { uc( (shift)->NEXT('foo', @_) ) } package main; use My::BaseClass; print My::BaseClass->class()->new()->foo(); print My::BaseClass->class( 'Logging' )->new()->foo(); print My::BaseClass->class( 'UpperCase' )->new()->foo(); print My::BaseClass->class( 'Logging', 'UpperCase' )->new()->foo(); DESCRIPTION
A class for use by classes which want a factory method. Inherit from this class to obtain the class() factory method, described below. PUBLIC METHODS
mixin_factory() BaseClass->mixin_factory() : $factory_object Gets the associated mixin factory. Generated the first time it is needed. class() BaseClass->class( @mixins ) : $package_name Calls the class() method on the associated mixin factory. SEE ALSO
For a facade interface that facilitates access to this functionality, see Class::MixinFactory. For distribution, installation, support, copyright and license information, see Class::MixinFactory::ReadMe. perl v5.10.1 2009-12-10 MixinFactory::HasAFactory(3pm)
All times are GMT -4. The time now is 07:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy