Sponsored Content
Top Forums Programming Pointer for 2D array seems to be 3D in C Post 302999280 by Corona688 on Friday 16th of June 2017 11:13:22 AM
Old 06-16-2017
1) They probably differ in being constants or non-constants.

3) It's "3d" because you have an extra pointer in the way. Every level of pointers requires another dereferencing operation to access it. One level pointer requires one. Two level pointer requires two. Three level pointer requires three. 97 level pointer requires 97. That is the pattern.

The first dereferencing operation gets rid of is x itself; once you do so, you are essentially accessing y. The next level of pointers points to individual rows inside y. The last level gets you an individual cell in that row.

Code:
x; // pointer to Y
(*x); // Y, i.e. pointer to rows
(*x)[0]; // Pointer to row 0
(*x)[0][0] // Row 0 col 0.  No longer a pointer.

The diagram is x -> y -> row -> column.
These 2 Users Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

pointer

void main() { int a={1,2,3,4,5,6,7,8,9,10}; int *p=a; int *q=&a; cout<<q-p+1<<endl; } The output is 10, how? if we give cout<<q it will print the address, value won't print.... if we give cout<<p it will print the address, value won't print.... p has the base addr; q... (1 Reply)
Discussion started by: sarwan
1 Replies

2. UNIX for Dummies Questions & Answers

Storing pointer array in C

All .. I am having a pointer array . And trying to store the addess into that pointer array . please see below the problem i faced code: int cnt1; char *t_array; char *f_array; for(cnt1=0; cnt1<1000; cnt1++) { t_array =... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

3. Programming

far pointer

what is far pointer in C (1 Reply)
Discussion started by: useless79
1 Replies

4. Programming

pass a pointer-to-pointer, or return a pointer?

If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it: (1) one is to pass a pointer-to-pointer parameter, like: int my_malloc(int size, char **pmem) { *pmem=(char *)malloc(size); if(*pmem==NULL)... (11 Replies)
Discussion started by: aaronwong
11 Replies

5. Programming

C pointer/array duality confusion

Hi all, Can anyone provide help with getting the right syntax regarding array/pointers in C in the following code? Can't locate a specific example which clarifies this... Say I declare a typedef to an array of pointers to some type... /** * An array of ptrs to sections */ typedef... (4 Replies)
Discussion started by: gorga
4 Replies

6. Programming

help with char pointer array in C

i have an array like #define NUM 8 .... new_socket_fd = accept(socket_fd, (struct sockaddr *) &cli_addr, &client_length); char *items = {"one", "two", "three", "four", "five", "six", "seven", "eight"}; char *item_name_length = {"3", "3", "5", "4", "4", "3", "5", "5"}; ... (1 Reply)
Discussion started by: omega666
1 Replies

7. Programming

structure pointer array as function parameters

if i create an array of pointers to a structure "struct node" as: struct node *r; and create "n" number of "linked lists" and assign it to the various struct pointers r using some function with a return type as structure pointer as: r=multiplty(.......) /*some parameters*/ is... (2 Replies)
Discussion started by: mscoder
2 Replies

8. Programming

Pointer and address

This code is to print out the program name and arguments list one by one: 1 #include<stdio.h> 2 3 void main(int argc, char *argv) 4 { 5 int iCount = 0; 6 while (iCount < argc) { 7 printf("argc:%d\t%s\n",iCount, argv); 8 ... (14 Replies)
Discussion started by: yifangt
14 Replies

9. Programming

Unclear pointer and array

Hello, The purpose of the program is to print a sub string from the prompt inputs. I do not understand why char pointer does not work but char array will for line 40 and Line 41. ./a.out thisisatest 0 8 substring = "thisisat"And my code is: #include <stdio.h> #include <stdlib.h> #include... (29 Replies)
Discussion started by: yifangt
29 Replies

10. Programming

Character pointer to Character array

how to copy content of character pointer to character array in c programming.. char *num; char name=num; (1 Reply)
Discussion started by: zinat
1 Replies
TableMatrix::SpreadsheetHideRows(3pm)			       perl/Tk Documentation			     TableMatrix::SpreadsheetHideRows(3pm)

NAME
Tk::TableMatrix::SpreadsheetHideRows - Table Display with selectable hide/un-hide of rows SYNOPSIS
use Tk; use Tk::TableMatrix::SpreadsheetHideRows my $t = $top->Scrolled('SpreadsheetHideRows', -selectorCol => 3, -expandData => $hashRef, -rows => 21, -cols => 11, -width => 6, -height => 6, -titlerows => 1, -titlecols => 1, -variable => $arrayVar, -selectmode => 'extended', -resizeborders => 'both', -titlerows => 1, -titlecols => 1, -bg => 'white', ); DESCRIPTION
Tk::TableMatrix::SpreadsheetHideRows is a Tk::TableMatrix::Spreadsheet-derived widget that implements a Spreadsheet-like display of tabular information, where some of the rows in the table can be expanded/hidden by clicking a '+/-' selector in the row. This can be used to display top-level information in a table, while allowing the user to expand certain table rows to view detail-level information. See demos/SpreadsheetHideRows in the source distribution for a simple example of this widget Widget-specific Options In addition the standard Tk::TableMatrix widget options. The following options are implemented: -selectorCol Column number where the +/- selector will appear. Clicking on the +/- selector will expand/hide the detail information in the table for a particular row. -selectorColWidth Width of the column used to display the +/- selector. Defaults to 2 -expandData Hash ref defining the detail-level data displayed when a row is expanded (by clicking the +/- selector). This hash ref should have the following structure: $expandData = { row1 => { tag => 'detailDataTag', data => $detailData, spans=> $spanData, expandData => $subLevelData }, row2 => { . . } Where: row1, row2, ... Row numbers that will be expandable. tag => 'detailDataTag' Tag name that will be applied to the detail data. (optional) $detailData 2D Array of detail-data to be displayed when the row is expanded. e.g. [ [ r1c1, r1c2, r1c3 ], [ r2c1, r2c2, r2,c3] ] $spans 1D array of span information (optional) to be used for display of the detail information. e.g. [ col2 => "rows,cols", col4 => "rows,cols", ... ] $subLevelData Optional Recursive expandData used to hold detail-data of detail-data. MEMBER DATA
The following items are stored as member data defaultCursor Name of the mouse cursor pointer that is used for normal (i.e. non-title, non-indicator) cells in the widget. This is set to the value of the $widget->cget(-cursor) option when the widget is created. indRowCols Hash ref of Row/Cols indexes where there are indicators stores. This is a quick lookup hash built from _expandData. _expandData Internal version of the expandData hash. Any sub-detail data (i.e. expand data that is at lower levels of expandData) that is visible is placed at the top level of this hash, for keeping track of the visible expandData. Widget Methods In addition the standard Tk::TableMatrix widget method. The following methods are implemented: showDetail Shows (i.e. expands the table) the detail data for a given row. This method is called when a user clicks on an indicator that is not already expanded. Usage: $widget->showDetail($row); # Shows the detail data for row number $row hideDetail Hides the detail data for a given row. This method is called when a user clicks on an indicator that is already expanded. Usage: $widget->hideDetail($row); # Hides the detail data for row number $row Tk1.23 2007-01-09 TableMatrix::SpreadsheetHideRows(3pm)
All times are GMT -4. The time now is 01:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy