Visual Studio 2015 "Sizeof" error

Learning C++ and windows programming. Received errors before debugging in the following example taken from "C++ Demystified":

// ConsoleProject2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "sizeof.h"
#include <iostream>
using namespace std;

int main(void)
{
cout << "Sizeof short is"
cout << "Sizeof int is"
cout << "Sizeof long is"
cout << "Sizeof float is"
cout << "Sizeof double is"
cout << "Sizeof long double is"
cout << "Sizeof char is"
cout << "Sizeof bool is"

return 0;
}

The code looks incomplete. The cout statements gives you an error because the lines does not end with a semicolon. You probably also want to add sizeof to print the actual sizes.

cout << "Sizeof short is " << sizeof(short) << '\n';
hey thanks alot it worked! this is my 2nd c++ tutorial. Cant wait to learn more.
I dont think you need the "sizeof.h" library for this im pretty sure either
"stdafx.h" or <iostream> contains the 'sizeof()' function
sizeof is an operator. It's build into the language so you don't need to include anything to use it.
Topic archived. No new replies allowed.