Hi gurus,
I have two files compiled together. One file has the following global
definition:
char s[] = "asdf";
Another file has the following declaration:
extern char *s;
Is there anything wrong here? I know that although char* s and char s[] are
not exactly the same, and in most case, they are interchangable. However,
when I use them in separate files, there are problems:
When I assign the value of s to another char * type local variable like
char *p = s;
Instead of the pointer s itself being assigned to the p, the value pointed
by s is assgined to p. That's certainly not my intention. I know roughly to
say, that's because the different view from the two source files, but how is
the detail? Has anybody here ever experienced similar problems? btw, I am
using Visual C++. Could it be a bug of VC++?
News - Ann 1 3866
"Newsgroup - Ann" <ne******@yahoo .com> wrote in message
news:3f******** **@rcfnews.cs.u mass.edu... Hi gurus,
I have two files compiled together. One file has the following global definition:
char s[] = "asdf";
Another file has the following declaration:
extern char *s;
Is there anything wrong here? I know that although char* s and char s[]
are not exactly the same, and in most case, they are interchangable. However, when I use them in separate files, there are problems:
Not exactly the same means different. The first is an array, the second is a
pointer. Do this
extern char s[]; // s is an array When I assign the value of s to another char * type local variable like
char *p = s;
Instead of the pointer s itself
s is not a pointer.
being assigned to the p, the value pointed by s is assgined to p.
That doesn't make sense. The value 'pointed' to by s is a char, how can a
char be assigned to a pointer?
That's certainly not my intention. I know roughly to say, that's because the different view from the two source files, but how
is the detail?
There is no detail, your code is wrong so you get incorrect behaviour.
Has anybody here ever experienced similar problems? btw, I am using Visual C++. Could it be a bug of VC++?
No, your code is wrong. Fix the code like I explained and if you are still
having problems post the corrected code. News - Ann
john This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: asdf |
last post by:
Hello,
I was enjoying working in VS for half a year without any problems and
now I cannot debug anymore. Without any really reason my Studio tells me
that the page that I want to debug has - No symbols loaded. I use VS
v1.7.3088 and .NET framework v1.1.4322 SP1.
I work with ASP.NET using VB and I'm trying to set a breakpoint on the
ascx.vb file.
|
by: taoberly |
last post by:
A few months ago I posted a question about using a file on my hard
drive to perform cross-frame scripting and pull data from a server on
my company's intranet. I eventually got this working using an HTA file
and Internet Explorer.
Now I'm tackling a similar issue, but really need to keep the IE menus,
navigation buttons, etc. this time around. Assuming a solution exists,
I'm guessing it involves using the IE6 SP2 "Mark of the Web"...
|
by: rosedream |
last post by:
I'm using BlueJ, not really sure if there is a diffrence in versions... i'm using windows XP if more info would be needed to indentify specific solution, please tell me what is needed. If this is a double post, my apologies. I searched quite a few pages and will need log off soon so can't check them all...
i'm new at java, so i'm gonna ask a question some(probably all) of u might think is stupid. i want to know how do u make the computer to...
|
by: Carrugar |
last post by:
Hi folks,
I am issuing the net use command on a couple of Win2003 servers. Some of these servers require that the name and password be authenticated twice and other servers just once, i.e.:
******************************************************************
C:\>net use p: \\pcp-web01\s
The password or user name is invalid for \\pcp-web01\s.
Enter the user name for 'pcp-web01': asdf
Enter the password for pcp-web01:
|
by: anon.asdf |
last post by:
Hi!
OK, lets try "array-copy":
{
char arrayA;
arrayA = (char){1, 2, 3};
}
it does *not* work since we're trying to make a fixed array-pointer
arrayA, point to another location/address (where there is an
| |
by: dhtmlkitchen |
last post by:
I'm trying to learn something about JScript engine.
I have the following example:
<script>(function() {
poop = "brown";
myFunction = function myFunction() {}
|
by: anon.asdf |
last post by:
In terms of efficieny:
Is it better to use multiple putchar()'s after one another as one gets
to new char's
OR
is it better to collect the characters to a char-array first, and then
use puts() to print to screen
????
|
by: jodleren |
last post by:
Hi
I have used JS for years, still I dont know this. I know the
difference in php but not in js.
window.open('page.htm'); and window.open("page.htm"); - what is the
difference?
/S
|
by: anon.asdf |
last post by:
Hello!
1) ===============================
When trying to define an array of std::string ...
func( (std::string ) { std::string("ab"), std::string("cd"),
std::string("ef") } , 3 );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
....g++ tells me: "invalid use of non-lvalue array"
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |