LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-30-2007, 08:09 AM   #1
graysky
LQ Newbie
 
Registered: Aug 2007
Posts: 2

Rep: Reputation: 0
"scull_devices" in the Char Drivers


My question is about a variable in the source code of "scull" in the "Linux Device Drivers".
It is declared like this:

Scull_Dev *scull_devices;

but then it is used like this:

scull_devices[i].quantum=scull.quantum;

the "scull_devices" is declared as a pointer points to a struct Scull_Dev,why it can be use like a array pointer?
 
Old 08-30-2007, 08:55 AM   #2
graysky
LQ Newbie
 
Registered: Aug 2007
Posts: 2

Original Poster
Rep: Reputation: 0
I am sorry for my poor english
 
Old 06-14-2020, 05:43 AM   #3
amstrad
LQ Newbie
 
Registered: Jun 2020
Posts: 1

Rep: Reputation: Disabled
scull_devices

Hello graysky,

apologies for the late replay...still there?

declaring an array scull_devices[i] makes scull_devices point to the first element of the array.
I assume the opposite way around is also true, i.e. declaring a pointer scull_devices lets you access the element pointed by accessing the first element of the array scull_devices[], although no array was declared.
Thus, subsequent elements can be accessed in the same way, as elements of the array: scull_devices[i].
The array is not capped, consistency is up to you...

Make sense? Just an assumption.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What does echo alias "char-major-10-224 off" >> /etc/modules.conf do? abefroman Linux - Software 2 09-16-2009 10:10 PM
How to convert "string" type to "char * " in c++ pranavojha Programming 18 06-05-2008 03:10 PM
Chinese laptop "Founder"," unichrome Pro" graph card drivers? Sirr Linux - Laptop and Netbook 3 07-14-2007 01:31 AM
How to convert "unsigned long long" to "char pointer"? novicehacker Linux - Kernel 1 11-20-2006 12:57 AM
"modprobe: can't locate module char-major-188"mesage eye Red Hat 4 10-23-2003 07:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration