C :: No Permanent Storage During Program Execution?

May 22, 2013

Code:

#include <stdio.h>
int sum_array(int * , int );
int main(void)
{
int total = sum_array( (int []) { 1 , 2 , 3 , 4 } , 4 );
}

[code]....

We create an unnamed array "on the fly" that it means array has no permanent storage during the program execution?

View 11 Replies


ADVERTISEMENT

C :: Program Come Out Without Proper Execution

Jul 11, 2013

the following code doesn't execute properly( After the second entry the program comes out)!!

Code:

#include<stdio.h>
void linkfloat();
int main(){
struct book {
char name;
float price;
int page;
};

[code]....

View 8 Replies View Related

C/C++ :: How To Increase Size Of Array During Program Execution

Apr 23, 2013

how we will increase the size of an arry during program execution. eg if the size of an array is 40 and during prog exexution we want to increase the size of an arry ,what is the procedure.

View 1 Replies View Related

C :: System Call To Pause Execution Of Program For Few Seconds

Feb 2, 2014

I know there has to be a system call to pause (not system("pause") execution of a program for a few seconds. I would like to give the illusion that my program is 'thinking' rather than just spit out the result as soon as the user has hit the enter key.

View 5 Replies View Related

C++ :: See Program Execution Step By Step?

Jul 29, 2013

Where can I see my program execution step by step? I want to see the changes every line of code do, line by line.

View 4 Replies View Related

C++ :: Category And Constant Storage

Mar 14, 2013

I have a class that I'm going to use to store a category. Right now there are seven options, but there is the potential for a whole lot more in the future. So I started off by storing an integer as the private member. I then used static constants to define the numeric values to represent each category, then a set of static constant strings that corresponds to those numbers in case I need their actual names. Finally I set up some static functions to convert between the integer value and the string, and vice versa.

I'm not sure if this is the best way to go about this. For one it makes the categories names and designations unchangeable. I thought that storing them in a file would be a better option, but then i needed a container that is the equivalent of a constant.

I thought of defining a class to contain an int and the associated string. It would be designed so that it can only be initialized with both items. Then provide no functionality to change the contents. So I've basically created my own constant.

View 4 Replies View Related

C++ :: Unlimited Storage For Variables

Jul 12, 2013

I am working on a project and I need to save and work on very big numbers, let me take u an example :

E.g. I want to find the biggest prime number ( 2,3,5,7,... ) but I just know about int, double and etc. which have unlimited storage .

How to save very big numbers on the memory and use them ?

View 5 Replies View Related

C++ :: Declare Not Allocating Storage?

Jan 22, 2014

decalration won't allocate storage, while definition will. This is a test program:

#include <iostream>
using namespace std;
extern int ei;
int i;

[Code].....

Others are all fine in this program except ei.
compiler error: undefined reference to ei.

I understand ei is only declared so there is no memory address, but when I do ei=1, then ei completed it's definition, why still cannot use pei to get it's address?

View 9 Replies View Related

C++ :: Invalid Storage Class For A Function?

Mar 23, 2014

I made a program and when I try to use the main driver to instantiate everything it says invalid storage class for a function. All of my code is in 4 separate files i'm just trying to get it to run now.

Code:
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <fstream>

[Code]......

View 1 Replies View Related

C++ :: Wedding Reception Data Storage?

Mar 4, 2014

I wanted to store information about a wedding reception and I'm having a few troubles with my program.

#include<iostream>
#include<windows.h>
#include <ctime>
#include<conio.h>
#include<string>
#include<fstream>
using namespace std;
#define on ,
void GREETING();

[code].....

View 1 Replies View Related

C/C++ :: Explicit Specialization Cannot Have A Storage Class

Jan 31, 2013

I am porting code from windows using visual studio to mac with xcode.

Quite a lot of issue have a appeared, which is no surprise, one warning that keeps on appearing is Explicit Specialiszation cannot have a storage class:

enum SortReturnCodeEnum {LOWEST=1, HIGHEST=2, HIGHLOW = 3, IDENTICAL=4};
template<typename tKey>
static SortReturnCodeEnum DefaultCompare(typename ArgType<tKey>::ARGT Value1, typename ArgType<tKey>::ARGT Value2)
{

[Code]....

I could do a #define __GNUC__ but i was checking

View 3 Replies View Related

C/C++ :: Storage Class Specifiers Concept?

Feb 15, 2013

Write a program using all storage class specifiers?

View 2 Replies View Related

C++ :: Two Identical Storage Containers - Typecasting

Oct 27, 2012

I have a situation where I have two identical storage containers:

Code:
////////////// multiplatform version
union _SOVector3 {
struct { float x, y, z; };
struct { float r, g, b; };
float v[3];

[Code] .....

SOVector3 is part of a namespace with specialized functions that are generic and intended for multiplatform usage.

GLKVector3 is dedicated to the Mac and has its own set of functions.

But what I want to do is freely interchange the storage between these two namespaces. Such as like this:

Code:
start = clock();
SOVector4 myVec4 = SOVector4Make(1.0f, 3.0, 6.0f, 1.0);
SOMatrix4 myMat4 = SOMatrix4Identity;
for (uint i=0; i<100000; ++i ) {

[Code] ....

But I am getting errors when I typecast this.

View 1 Replies View Related

C++ :: How Item Storage System Is Supposed To Work

Feb 14, 2013

So the RPG I have been making is based on this tutorial URL.....I don't entirely understand how the Item storage system is supposed to work. It looks like the array shown is for one item but, there are 3 lines of code that correlate. The author says that this is a repeatable bit of code for each item so.... i'm just completely lost. The player will have two or three to start and there are 4 battle/health items and one key ....

View 2 Replies View Related

Visual C++ :: Read Excel File And Storage In Array

Nov 4, 2014

I wish to read an excel file which contains the table shown at the picture below.

I don't really know how to code the direct storage of the values in the appropriate array.

For example I wish to store the countries in an array of a string type.

could I have some piece of code which illustrates it (I mean the reading of an excel file and the direct storage of his value in an array).

View 1 Replies View Related

C :: Storage Types / Formatted Input / Output / Processing A Menu

Feb 1, 2013

where to start and how it should be structured. how I should go about writing this program, like should i make functions, pointers, etc. And to display the menu, is it easiest to just use printf statements or is there something more efficient.

View 3 Replies View Related

C++ :: Access Serial Port - This Declaration Has No Storage Class Or Type Specifier

Feb 26, 2013

I am writing a code using Visual C++ to access serial port.

Code:
HANDLE hSerial= CreateFile(L"COM1", GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
DCB dcb = {0};
dcb.DCBlength=sizeof(dcbSerialParams);
dcb.BaudRate=CBR_1200;
dcb.ByteSize=8;
dcb.StopBits=ONESTOPBIT;
dcb.Parity=NOPARITY;

I am getting error in all last five lines in above code at dcb. and error is give below:-

Error: this declaration has no storage class or type specifier

View 2 Replies View Related

C++ :: How To Boost Up Execution

Feb 23, 2013

I wrote a program to run long simulations, in one cpu core computation. During the run, I checked the cpu occupation was always around 85%.

Since my simulation took time to run. How can I boost it up to make my cpu run at 100%? Is that because my RAM is not fast enough?

info about my laptop: cpu frequency: up to 3.2 GHz. RAM frequency: 1333 MHz.

View 2 Replies View Related

C :: Possible To Call A Function During Execution?

Feb 16, 2013

I want to write a function and be able to call it during execution (say during a while(1) loop). Is this possible without having to parse an input string to extract the function and parameters I need or is that the only way?

View 1 Replies View Related

C++ :: Preventing Execution Of A Function

Jun 26, 2013

PHP Code:

class MyClass{};namespace BI{    class BusinessInterop {    
public:        static MyClass* func( {
printf("BusinessInterop");return new MyClass();}    

[Code] .....

I would like to know how to prevent the program print out "Business", I'd like it to call the base class's static function. I have tried to changed MyClass* into void* but it still prints Business :grumpy:.

My challenge is to output "BusinessInterop" without any changes made to the polymorphic structure as designed.

View 7 Replies View Related

C :: Unary Increment Operator Execution

Nov 28, 2013

how the output for the program below comes to 45 and 46 respectively.

Code:
#include<stdio.h>
#include<conio.h>
void main()
{
int x=10,y=10;
clrscr();
//printf("%d

[Code] ....

The output obtained for the above program is 45 and 46.

View 4 Replies View Related

C++ :: Windows Path - Folder Of Execution

Jan 17, 2014

This question is currently only for windows; but I would like to know about a cross-platform way to perform what I want to do (explained below) -

I have created a little program:

#include <iostream>
int main(int argc, char *argv[]) {
for (int i = 0; i < argc; ++i) {
std::cout << argv[i] << '
';
} }

I have added this program to the windows PATH. I put this program in C:Program FilesProgram

I now navigate to C:DataVariousTexts using CMD.

Then I type in: "program x"

The program will print out "program x" as by default. What I would like to get hold of is the folder in which the program is actually being called. ( I want to somehow get "C:DataVariousTexts" to be read into my program ).

How do I perform such an operation?

View 5 Replies View Related

C# :: Fatal Error During Command Execution

Dec 31, 2014

Why i keep getting the above error. below is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;

[Code] .....

Attached image(s)

View 5 Replies View Related

C# :: How To Repeat Execution Of Code Using Counter

Oct 22, 2014

I have a method that changes a canvas color after set intervals, e.g. start timer, 5 seconds green, 3 seconds red, then stop. This functionality is provided in the interval method. The problem I'm trying to achieve is getting this sequence to repeat for a set number of iterations.

I tried to solve this by setting up a counter after the timer is stopped but the code keeps repeating indefinitely by starting and stopping over and over instead of the max of 6 iterations I had set. In debugging the problem, I watched the value of 'i' and when the 'if' statement is set to false. The 'if' statement gets set to false after 7 iteration as expected but the start(); keeps getting called.

void myTimer_Tick(object sender, EventArgs e) {
//Assign text box string value to a time span variable.
TimeSpan workTm = TimeSpan.ParseExact(wrkString, @"hh : mm : ss : fff", CultureInfo.InvariantCulture);
TimeSpan restTm = TimeSpan.ParseExact(rstString, @"hh : mm : ss : fff", CultureInfo.InvariantCulture);

// update the textblock on the display
// with hh, mm, ss, ms
ms = myStopwatch.ElapsedMilliseconds;

[Code] .....

View 1 Replies View Related

C++ :: Comparing Execution Times Of Summation

Mar 17, 2014

This is the problem:

1+2+3+...+n=(n(n+1))/2

Write a C++ program that compares the execution time of the above summation using two different solutions: one that uses loops, and another that uses the closed form approach. Use large values of n for the comparisons, such as, 10^7, 10^8, 10^9, 10^10, 10^11,10^12, 10^13, and 10^14. Provide a comparison table for the execution time in both solutions.Do not worry about the value of the actual sum. Overflow will occur in the sum value rendering it invalid; however, this is not the primary concern of the program. Execution time is the primary concern.

View 1 Replies View Related

C :: Anomalous Execution Of For Loop And The Function Call

Aug 18, 2014

I have a for loop, and after this loop, I am calling another function that wakes a thread S, and then thread S carries on its execution.

Code:

for (k = 0; k < num_msg; k++) {
if( (c % Messages[k][2] ) == 0 ) {
printf("
%d, act, %d

[Code]....

I am getting an anomalous output. Before all the iterations of for loop could finish, the program enters into the invoke_thread_S() and I can see the remaining iterations of for loop happening after thread S is finished.

What could be the problem here. Can I put a 'sleep' before I enter into invoke_thread_S() function, I tried it with a very small amount (in nano seconds), but that did not solve the problem.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved