|
by: Noah Spitzer-Williams |
last post by:
Hello guys,
I would like to do something seemingly simple: find out if an
element in an array that is passed to my function exists.
I used to think I could just do: if (arr) ...
However, if this element's value happens to be 0, the conditional
will return false, even though the element actually exists.
Any ideas? Can you check if the element == null?
|
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of code...
TCHAR myArray;
DoStuff(myArray);
|
by: ritchie |
last post by:
Hi all!
Still working on this program!
Just to recap, I am writing a program to sort an array with four
different sort algorythms.
I am having a little trouble at the moment though!
Now, I am trying to calculate, with each sort, how many times during
the sort the array elements are compared and swapped.
|
by: Gerald |
last post by:
I have a problem with an array of pointers.
In a program I'm writing, I have to read a file, containing thousands
of short lines. The content of another file will be compared against
each line later on. Before that happens there has been a problem that
causes a crash of the program.
This is a little program "test.exe" I wrote to test what happens.
compiler: mingw 3.1.01 for win32 command line
|
by: Herrcho |
last post by:
in K&R Chapter 6.3
it mentions two methods to calculate NKEYS.
and points out the first one which is to terminate the list of
initializers with a null pointer, then loop along keytab until the end
is found is less efficient than using sizeof operator , since size of
the array is completely determined at compile time.
i don't quite understand this. Could anyone explain to me in detail ?
|
|
by: Wynand Winterbach |
last post by:
I think every C programmer can relate to the frustrations that malloc
allocated arrays bring. In particular, I've always found the fact that
the size of an array must be stored separately to be a nightmare.
There are of course many solutions, but they all end up forcing you to
abandon the array syntax in favour of macros or functions.
Now I have two questions - one is historical, and the other practical.
1.) Surely malloc (and...
|
by: simkn |
last post by:
Hello,
I'm writing a function that updates an array. That is, given an
array, change each element.
The trick is this: I can't change any elements until I've processed
the entire array. For example, the manner in which I update element 1
depends on several other (randomly numbered) elements in the array.
So, I can't change an element until I've figured out how every element
changes.
|
by: manochavishal |
last post by:
Hi,
I have a question.
How can i know the size of array when it is passed to a function.
For Example i have this code:
#include <stdio.h>
#include <stdlib.h>
|
by: Cyn |
last post by:
Hi,
I want to create a general array structure which can hold all types.
Something like this:
struct ARRAY
{
void **array;
size_t size;
};
|
by: Nepomuk |
last post by:
Hi!
I've read, that in C++ there's no predefined method, to calculate the size of an array. However, it's supposed to work withsizeof(array)/sizeof(array)Now, this does work in some situations, but not in others. Here's what I mean:#include <iostream>
int length(int * array){return sizeof(array)/sizeof(array);}
int main()
{
int array1 = {3,2,1,0};
std::cout << "Length of array1: " << sizeof(array1)/sizeof(array1) << "\n"
<<...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|